import request from "@/utils/request";
import { useStore } from "@/stores/index1";
import { useStoreData } from "@/stores/data";
import renderer from "@/utils/tool/renderer";
const storeData: any = useStoreData();
const store = useStore();
/**
 * 标绘图标上传
 */
export const uploadDrawIcon = async (data = {}) => {
    return await request.uploading("/sxnf-biz/oss/upload_minio_mapStyle", data).then((res) => {
        let data = res.data;
        const url = `http://localtest.sxfarmer.com:9000/sxnf-cloud/${data.dir}${data.fileName}`;
        data.url = url;
        return res;
    });
};
/**
 * 获取所有标绘数据
 */
export const getAllDrawData = async (data = {}) => {
    console.log(store.baseId);
    return await request.get(`/sxnf_team/baseFolder/getDrawingByBaseId?id=${store.baseId}`, data).then((res) => {
        renderer(res.data);
        return res;
    });
};
/**
 * 获取当前用户标绘数据
 */
export const getUserDrawData = async (data = {}) => {
    return await request.get("/sxnf_team/draw/getDrawsByUserId", data).then((res) => {
        return res;
    });
};
/**
 * 创建标绘数据
 */
export const saveDrawData = async (data = {}) => {
    return await request.post("/sxnf_team/draw/addDraw", data).then((res) => {
        return res;
    });
};
/**
 * 修改标绘数据
 */
export const updateDrawData = async (data = {}) => {
    return await request.post("/sxnf_team/draw/updateDraw", data).then((res) => {
        return res;
    });
};
/**
 * 删除标绘数据
 */
export const removeDrawData = async (data = {}) => {
    return await request.post("/sxnf_team/draw/removeDrawById", data).then((res) => {
        return res;
    });
};
/**
 * 上传金字塔瓦片图层
 */
export const uploadXyzLayers = async (data = {}) => {
    return await request.uploading("/sxnf_team/draw/uploadDrawingLayer", data).then((res) => {
        return res;
    });
};
/**
 *
 */
